<!DOCTYPE html>  
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN"> 
<head> 
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<title>普通商品管理</title>
	<!-- 常规css -->
    <link th:href="@{bootstrap/css/bootstrap.min.css}" rel="stylesheet" />
    <link th:href="@{font-awesome/css/font-awesome.min.css}" rel="stylesheet" />
    <!-- 项目css -->
    <link th:href="@{css/layout.css}" rel="stylesheet" />
</head> 
<body th:with="asort=${#httpServletRequest.getParameter('sort')}, aorder=${#httpServletRequest.getParameter('order')}, num=${data.num}, pageIndex=${data.pageIndex}">
	<!-- 侧边导航栏 -->
	<div th:replace="aframe::sideNavigation"></div>
	
	<!-- 主页面 -->
	<div class="content" style="padding:0">
		<!-- 顶部导航栏 -->
		<div th:replace="aframe::topNavigation"></div>
		<!-- 内容 -->

		<!-- 标签页内容 -->
		<div role="tabpanel" class="tab-pane active" id="history" style="margin:20px">
			<div class="panel panel-default" >
				<div class="panel-heading">
					<h4>商家管理&nbsp;&nbsp;
						<span><button class="btn btn-sm btn-success" th:onclick="shopShowAdd()">添加商家</button></span>
					</h4>
				</div>
				<div class="panel-body table-responsive">
					<table class="table table-hover">
						<thead>
						<tr>
							<th>编号</th>
							<th>商家名</th>
							<th>图片</th>
							<th>描述</th>
							<th>地址</th>
							<th>客服电话</th>
							<th>负责人</th>
							<th>评分</th>
							<th>入驻时间</th>
							<th>修改时间</th>
							<th>操作</th>
						</tr>
						</thead>
						<tbody>
						<tr th:each="shop: ${data.list}">
							<th scope="row" th:text="${shop?.shopId}">编号</th>
							<td th:text="${shop?.shopName}">商家名</td>

							<td><button type="button" class="btn btn-default btn-sm" th:text="查看" data-toggle="modal" th:data-target="'#showImgModal'+${shop?.shopId}"></button></td>
							<!-- 图片显示模态框 -->
							<div class="modal fade text-center" th:id="'showImgModal'+${shop?.shopId}">
								<div class="modal-dialog modal-lg" style="display: inline-block; max-height: 800px; width: auto;">
									<div class="modal-content">
										<img th:src="${shop?.shopPic}" style="max-height: 820px">
									</div>
								</div>
							</div>

							<td th:text="${shop?.shopDesc}">描述</td>
							<td th:text="${shop?.shopAddr}">地址</td>
							<td th:text="${shop?.servicePhone}">客服电话</td>
							<td th:text="${shop?.ownerName}">负责人</td>
							<td th:text="${shop.shopScore!=null ? shop.shopScore : '暂无'}">评分</td>
							<td th:text="${#dates.format(shop?.shopTime, 'yyyy-MM-dd')}">入驻时间</td>
							<td th:text="${#dates.format(shop?.modifyTime, 'yyyy-MM-dd')}">修改时间</td>
							<td>
								<button class="btn btn-sm btn-info" th:onclick="shopShowDetail([[${shop?.shopId}]])">查看</button>
								<button class="btn btn-sm btn-info" th:onclick="showSales([[${shop?.shopId}]])">销售额</button>
								<button class="btn btn-sm btn-primary"  th:onclick="shopShowEdit([[${shop?.shopId}]])">编辑</button>
								<button class="btn btn-sm btn-danger"  th:onclick="shopShowDelete([[${shop?.shopId}]])">删除</button>
							</td>
						</tr>
						</tbody>
					</table>

					<!-- 分页 -->
					<div th:replace="aframe::pagingBar"></div>

				</div>
			</div>
		</div>
	</div>
		<!-- end 内容 -->
	<!-- end 主页面 -->

	<!-- 模态框: 信息 -->
	<form class="form-horizontal" role="form" style="margin: 20px;">
		<div class="modal fade" id="shopDetailModal" tabindex="-1" role="dialog" aria-labelledby="detailModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						<h4 class="modal-title" id="detailModalLabel"> 商家信息 </h4>
					</div>
					<div class="modal-body">
						<div class="form-group">
							<label class="col-sm-3 control-label">商家名称</label>
							<div class="col-sm-7">
								<p class="form-control-static" id="d_shopName"></p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">商家描述</label>
							<div class="col-sm-7">
								<p class="form-control-static" id="d_shopDesc"></p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">商家图片</label>
							<div class="col-sm-7">
								<img class="form-control-static" id="d_shopPic" alt="商家图片" style="height:100px;max-height: 100px">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">商家地址</label>
							<div class="col-sm-7">
								<p class="form-control-static" id="d_shopAddr"></p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">入驻时间</label>
							<div class="col-sm-7">
								<p class="form-control-static" id="d_shopTime"></p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">修改时间</label>
							<div class="col-sm-7">
								<p class="form-control-static" id="d_modifyTime"></p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">营业时间</label>
							<div class="col-sm-7">
								<p class="form-control-static" id="d_businessHours"></p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">客服电话</label>
							<div class="col-sm-7">
								<p class="form-control-static" id="d_servicePhone"></p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">负责人</label>
							<div class="col-sm-7">
								<p class="form-control-static" id="d_ownerName"></p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">联系电话</label>
							<div class="col-sm-7">
								<p class="form-control-static" id="d_ownerPhone"></p>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">店铺评分</label>
							<div class="col-sm-7">
								<p class="form-control-static" id="d_shopScore"></p>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					</div>
				</div>
			</div>
		</div>
	</form>

	<!-- 模态框: 编辑 -->
	<form class="form-horizontal" role="form" id="shopEditForm" style="margin: 20px;">
		<div class="modal fade" id="shopEditModal" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
			<div class="modal-dialog modal-lg">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						<h4 class="modal-title" id="editModalLabel"> 商家编辑 </h4>
					</div>
					<div class="modal-body" style="height: 440px">
						<div class="col-sm-6">
							<div class="form-group">
								<input type="hidden" name="shopId" id="e_shopId">
								<label class="col-sm-3 control-label">商家名称</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="e_shopName" name="shopName" placeholder="请输入商家名称">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">商家描述</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="e_shopDesc" name="shopDesc" placeholder="请输入商家描述">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">营业时间</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="e_businessHours" name="businessHours" placeholder="请输入营业时间，如9:00-17:00">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">客服电话</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="e_servicePhone" name="servicePhone" placeholder="请输入客服电话">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">负责人姓名</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="e_ownerName" name="ownerName" placeholder="请输入负责人姓名">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">负责人电话</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="e_ownerPhone" name="ownerPhone" placeholder="请输入负责人电话">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">商家照片</label>
								<div class="col-sm-7">
									<input type="file" class="form-control" id="d_shopPic" name="file" placeholder="请上传商家图片">
								</div>
							</div>
						</div>
						<div class="col-sm-6">
							<div class="form-group">
								<label class="col-sm-3 control-label">商家地址</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id='e_address' name="shopAddr" placeholder="请输入地址或点击地图选择" >
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">经纬度</label>
								<div class="col-sm-7">
									<input readonly type="text" class="form-control" id='e_lnglat' name="lnglat" placeholder="点击按钮获取经纬度" >
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label"></label>
								<div class="col-sm-7">
									<input id="geoButton" type="button" class="btn" value="获取经纬度" />
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label"></label>
								<div class="col-sm-7">
									<div id="mapContainer" style="width: 230px; height: 230px; "></div>
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
						<button type="button" class="btn btn-primary" id="shopEditButton">确认修改</button>
					</div>
				</div>
			</div>
		</div>
	</form>

	<!-- 模态框: 添加 -->
	<form class="form-horizontal" role="form" id="shopAddForm" style="margin: 20px;">
		<div class="modal fade" id="shopAddModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel" aria-hidden="true">
			<div class="modal-dialog modal-lg">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						<h4 class="modal-title" id="addModalLabel"> 添加商家 </h4>
					</div>
					<div class="modal-body" style="height: 460px">
						<div class="col-sm-6">
							<div class="form-group">
								<input type="hidden" name="goodsId" id="a_goodsId">
								<label class="col-sm-3 control-label">商家名称</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="a_shopName" name="shopName" placeholder="请输入商家名称">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">商家描述</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="a_shopDesc" name="shopDesc" placeholder="请输入商家描述">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">营业时间</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="a_businessHours" name="businessHours" placeholder="请输入营业时间，如9:00-17:00">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">客服电话</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="a_servicePhone" name="servicePhone" placeholder="请输入客服电话">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">负责人姓名</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="a_ownerName" name="ownerName" placeholder="请输入负责人姓名">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">负责人电话</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id="a_ownerPhone" name="ownerPhone" placeholder="请输入负责人电话">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">商家图片</label>
								<div class="col-sm-7">
									<input type="file" class="form-control" id="a_shopPic" name="file" placeholder="请上传商家图片">
								</div>
							</div>
						</div>
						<div class="col-sm-6">
							<div class="form-group">
								<label class="col-sm-3 control-label">商家地址</label>
								<div class="col-sm-7">
									<input type="text" class="form-control" id='a_address' name="shopAddr" placeholder="请输入地址或点击地图选择" >
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">经纬度</label>
								<div class="col-sm-7">
									<input readonly type="text" class="form-control" id='a_lnglat' name="lnglat" placeholder="点击按钮获取经纬度" >
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label"></label>
								<div class="col-sm-7">
									<input id="a_geoButton" type="button" class="btn" value="获取经纬度" />
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label"></label>
								<div class="col-sm-7">
									<div id="a_mapContainer" style="width: 230px; height: 230px; "></div>
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
						<button type="button" class="btn btn-primary" id="shopAddButton">确认添加</button>
					</div>
				</div>
			</div>
		</div>
	</form>



	<!-- 模态框: 查看销量 -->
	<form class="form-horizontal" role="form" id="salesForm" style="margin: 20px;">
		<div class="modal fade" id="salesModal" tabindex="-1" role="dialog" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						<h4 class="modal-title"> 销售额 </h4>
					</div>
					<div class="modal-body">
						<fieldset>
							<legend>概览</legend>
							<div class="form-group">
								<label class="col-sm-3 control-label">店铺名称</label>
								<div class="col-sm-7">
									<p class="form-control-static" id="s_name"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">年销售额</label>
								<div class="col-sm-7">
									<p class="form-control-static" id="s_yearSale"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">月销售额</label>
								<div class="col-sm-7">
									<p class="form-control-static" id="s_monthSale"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">周销售额</label>
								<div class="col-sm-7">
									<p class="form-control-static" id="s_weekSale"></p>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">日销售额</label>
								<div class="col-sm-7">
									<p class="form-control-static" id="s_daySale"></p>
								</div>
							</div>
						</fieldset>

						<fieldset>
							<legend>时间段查询</legend>
							<div class="form-group">
								<label class="col-sm-3 control-label">开始时间</label>
								<input type="hidden" name="shopId" id="s_id">
								<div class="col-sm-7">
									<input type="datetime-local" class="form-control" name="begin">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">截止时间</label>
								<div class="col-sm-7">
									<input type="datetime-local" class="form-control" name="end">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">销售额</label>
								<div class="col-sm-7">
									<p class="form-control-static" id="s_sale"></p>
								</div>
							</div>
						</fieldset>

					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
						<button type="button" class="btn btn-primary" id="saleButton">查询</button>
					</div>
				</div>
			</div>
		</div>
	</form>




	<!-- 模态框: 修改密码 -->
	<div th:replace="aframe::modifyPwd"></div>


<!-- 常规js -->
<script th:src="@{js/jquery-3.4.1.min.js}"></script>
<script th:src="@{bootstrap/js/bootstrap.min.js}"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=def65cfd4497e391200c2796f73f7435&plugin=AMap.Geocoder"></script>
<!-- 模板js -->
<script th:replace="aframe::js-highlight"></script>
<!-- 项目js -->
<script th:src="@{js/md5.js}"></script>
<script th:src="@{js/setpwd.js}"></script>
<!-- 页面js -->
<script th:src="@{js/shop.js}"></script>



</body>
</html> 

